// 班级模块所有请求

import request from '@/utils/request'

// 获取班级列表信息
export const getClassInfo = (params) => {
  return request({
    url: '/class/class',
    params
  })
}

// 获取学科信息
export const getSubjectInfo = () => {
  return request({
    url: '/subject/tree'
  })
}

// 添加班级
export const addClass = (data) => {
  return request({
    url: '/class/class',
    method: 'POST',
    data
  })
}

// 删除班级
export const delClass = (id) => {
  return request({
    url: `/class/class/${id}`,
    method: 'DELETE'
  })
}

// 编辑班级回显数据
export const editGetClass = (id) => {
  return request({
    url: `/class/class/${id}`,
    method: 'GET'
  })
}

// 编辑状态
export const editState = (data) => {
  return request({
    url: `/class/class/${data.id}`,
    method: 'PUT',
    data
  })
}

// 获取学生列表信息
export const getStudentInfo = (params) => {
  return request({
    url: '/class/student',
    method: 'GET',
    params
  })
}

// 删除学生信息
export const delStudentInfo = (data) => {
  return request({
    url: '/class/student',
    method: 'DELETE',
    data
  })
}

// 添加学生信息
export const addStudentInfo = (data) => {
  return request({
    url: '/class/student',
    method: 'POST',
    data
  })
}

// 根据id获取学生信息
export const getStudentInfoById = (id) => {
  return request({
    url: `/class/student/${id}`,
    method: 'GET'
  })
}

// 添加学生信息
export const editStudentInfo = (data) => {
  return request({
    url: `/class/student/${data.id}`,
    method: 'PUT',
    data
  })
}

// 导入学生信息
export const importStudentInfo = (data) => {
  return request({
    url: '/class/student/import',
    method: 'POST',
    data
  })
}

// 批量修改数据
export const editDataAll = (data) => {
  return request({
    url: '/class/studentChangeStatus',
    method: 'PUT',
    data
  })
}
